﻿namespace HuaWei.CBR.QTJL
{
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Grid;
    using HuaWei.CommClass;
    using HuaWei.CommComp;
    using HuaWei.Windows.Forms;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmWYFJ : FrmBase
    {
        private BindingSource bindingSource;
        private SimpleButton btnAdd;
        private SimpleButton btnDel;
        private GridColumn gridColumn13;
        private GridColumn gridColumn14;
        private GridColumn gridColumn27;
        private GridControl gridControl2;
        private GridView gridView3;
        private GroupControl groupControl1;
        private IContainer icontainer1 = null;
        private MemoEdit memoEdit5;
        private PanelControl panelControl8;
        private RepositoryItemCheckEdit repositoryItemCheckEdit1;

        public FrmWYFJ()
        {
            this.InitializeComponent();
        }

        private void bindingSource_PositionChanged(object sender, EventArgs e)
        {
            this.ControlFormStatus();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            DHelp.DataAddNew(this.bindingSource, "", "");
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            if ((this.bindingSource.List.Count > 0) && (MsgBox.ShowQuestion("是否删除当前记录？") == System.Windows.Forms.DialogResult.OK))
            {
                this.bindingSource.RemoveCurrent();
                this.bindingSource.EndEdit();
                base.Save();
            }
        }

        public override void ControlFormStatus()
        {
            if (!((GParams.QCInfo.QCZT <= 0) && GParams.DZYZ))
            {
                DevCCHelp.ControlForm(base.Controls, true, 2);
            }
            else if (!((int) Convert.ToInt16(DHelp.GetObjValue(this.bindingSource, "QRXD", true))).Equals(1))
            {
                DevCCHelp.ControlForm(base.Controls, false, 1);
            }
            else
            {
                DevCCHelp.ControlForm(base.Controls, true, 1);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer1 != null))
            {
                this.icontainer1.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmWYFJ_Load(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void InitializeComponent()
        {
            this.icontainer1 = new Container();
            this.bindingSource = new BindingSource(this.icontainer1);
            this.gridControl2 = new GridControl();
            this.gridView3 = new GridView();
            this.gridColumn13 = new GridColumn();
            this.gridColumn14 = new GridColumn();
            this.gridColumn27 = new GridColumn();
            this.repositoryItemCheckEdit1 = new RepositoryItemCheckEdit();
            this.panelControl8 = new PanelControl();
            this.btnDel = new SimpleButton();
            this.btnAdd = new SimpleButton();
            this.groupControl1 = new GroupControl();
            this.memoEdit5 = new MemoEdit();
            base.ds.BeginInit();
            base.dsQuery.BeginInit();
            base.dataSets.BeginInit();
            ((ISupportInitialize) this.bindingSource).BeginInit();
            this.gridControl2.BeginInit();
            this.gridView3.BeginInit();
            this.repositoryItemCheckEdit1.BeginInit();
            this.panelControl8.BeginInit();
            this.panelControl8.SuspendLayout();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.memoEdit5.Properties.BeginInit();
            base.SuspendLayout();
            this.bindingSource.DataMember = "QTJL_WYFJ";
            this.bindingSource.DataSource = base.dataSets;
            this.gridControl2.DataSource = this.bindingSource;
            this.gridControl2.Dock = DockStyle.Left;
            this.gridControl2.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gridControl2.Location = new Point(0, 0x1b);
            this.gridControl2.MainView = this.gridView3;
            this.gridControl2.Name = "gridControl2";
            this.gridControl2.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemCheckEdit1 });
            this.gridControl2.Size = new Size(280, 0x1e2);
            this.gridControl2.TabIndex = 0x17;
            this.gridControl2.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView3 });
            this.gridView3.Columns.AddRange(new GridColumn[] { this.gridColumn13, this.gridColumn14, this.gridColumn27 });
            this.gridView3.GridControl = this.gridControl2;
            this.gridView3.Name = "gridView3";
            this.gridView3.OptionsCustomization.AllowFilter = false;
            this.gridView3.OptionsCustomization.AllowSort = false;
            this.gridView3.OptionsView.ColumnAutoWidth = false;
            this.gridView3.OptionsView.ShowGroupPanel = false;
            this.gridColumn13.Caption = "违约日期";
            this.gridColumn13.FieldName = "WYRQ";
            this.gridColumn13.Name = "gridColumn13";
            this.gridColumn13.Visible = true;
            this.gridColumn13.VisibleIndex = 0;
            this.gridColumn13.Width = 0x5c;
            this.gridColumn14.Caption = "违约罚金";
            this.gridColumn14.FieldName = "WYFJ";
            this.gridColumn14.Name = "gridColumn14";
            this.gridColumn14.Visible = true;
            this.gridColumn14.VisibleIndex = 1;
            this.gridColumn14.Width = 0x51;
            this.gridColumn27.Caption = "确认下达";
            this.gridColumn27.ColumnEdit = this.repositoryItemCheckEdit1;
            this.gridColumn27.FieldName = "QRXD";
            this.gridColumn27.Name = "gridColumn27";
            this.gridColumn27.Tag = "-1";
            this.gridColumn27.Visible = true;
            this.gridColumn27.VisibleIndex = 2;
            this.gridColumn27.Width = 60;
            this.repositoryItemCheckEdit1.AutoHeight = false;
            this.repositoryItemCheckEdit1.DisplayValueChecked = "1";
            this.repositoryItemCheckEdit1.DisplayValueUnchecked = "0";
            this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit1";
            this.repositoryItemCheckEdit1.NullStyle = StyleIndeterminate.Unchecked;
            this.repositoryItemCheckEdit1.ValueChecked = 1;
            this.repositoryItemCheckEdit1.ValueUnchecked = 0;
            this.panelControl8.Controls.Add(this.btnDel);
            this.panelControl8.Controls.Add(this.btnAdd);
            this.panelControl8.Dock = DockStyle.Top;
            this.panelControl8.Location = new Point(0, 0);
            this.panelControl8.Name = "panelControl8";
            this.panelControl8.Size = new Size(0x2ef, 0x1b);
            this.panelControl8.TabIndex = 0x19;
            this.btnDel.Dock = DockStyle.Left;
            this.btnDel.Location = new Point(0x34, 2);
            this.btnDel.Name = "btnDel";
            this.btnDel.Size = new Size(50, 0x17);
            this.btnDel.TabIndex = 4;
            this.btnDel.Tag = "-1";
            this.btnDel.Text = "删除";
            this.btnDel.Click += new EventHandler(this.btnDel_Click);
            this.btnAdd.Dock = DockStyle.Left;
            this.btnAdd.Location = new Point(2, 2);
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Size = new Size(50, 0x17);
            this.btnAdd.TabIndex = 3;
            this.btnAdd.Tag = "-1";
            this.btnAdd.Text = "新增";
            this.btnAdd.Click += new EventHandler(this.btnAdd_Click);
            this.groupControl1.Controls.Add(this.memoEdit5);
            this.groupControl1.Dock = DockStyle.Fill;
            this.groupControl1.Location = new Point(280, 0x1b);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x1d7, 0x1e2);
            this.groupControl1.TabIndex = 0x1a;
            this.groupControl1.Text = "违约内容";
            this.memoEdit5.DataBindings.Add(new Binding("EditValue", this.bindingSource, "WYNR", true));
            this.memoEdit5.Dock = DockStyle.Fill;
            this.memoEdit5.Location = new Point(2, 0x17);
            this.memoEdit5.Name = "memoEdit5";
            this.memoEdit5.Size = new Size(0x1d3, 0x1c9);
            this.memoEdit5.TabIndex = 6;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize = new Size(0x2ef, 0x1fd);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.gridControl2);
            base.Controls.Add(this.panelControl8);
            base.Name = "FrmWYFJ";
            this.Text = "违约罚金";
            base.Load += new EventHandler(this.FrmWYFJ_Load);
            base.ds.EndInit();
            base.dsQuery.EndInit();
            base.dataSets.EndInit();
            ((ISupportInitialize) this.bindingSource).EndInit();
            this.gridControl2.EndInit();
            this.gridView3.EndInit();
            this.repositoryItemCheckEdit1.EndInit();
            this.panelControl8.EndInit();
            this.panelControl8.ResumeLayout(false);
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.memoEdit5.Properties.EndInit();
            base.ResumeLayout(false);
        }

        public override void LoadedForm()
        {
            this.bindingSource.DataSource = base.ds.Tables["QTJL_WYFJ"];
            this.bindingSource.PositionChanged += new EventHandler(this.bindingSource_PositionChanged);
            base.LoadedForm();
        }

        public override void LoadingData()
        {
            this.panelControl8.Visible = GParams.DZYZ;
            base.LoadingData();
            base.ds.Clear();
            string str = null;
            str = "select * from QTJL_WYFJ " + Class28.YfQclfhSo(GParams.QCInfo.QCID, "");
            Class39.smethod4(base.ida, base.ds, str, "QTJL_WYFJ", true);
        }

        private void method1(object sender, EventArgs e)
        {
        }

        public override void Saving()
        {
            base.Saving();
            this.bindingSource.MoveFirst();
            this.bindingSource.EndEdit();
        }
    }
}

